public class Lab01_Task5 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        String plate = args[0];
        String start_time = args[1];
        String end_time = args[2];
        String bar = "\n++++++++++++++++++++++";
        
        String[] stimeparts = start_time.split("h");
        String[] etimeparts = end_time.split("h");
        
        int shours = Integer.parseInt(stimeparts[0]);
        int smins = Integer.parseInt(stimeparts[1]);
        int ehours = Integer.parseInt(etimeparts[0]);
        int emins = Integer.parseInt(etimeparts[1]);
        
        int stime_in_mins = (shours*60)+smins;
        int etime_in_mins = (ehours*60)+emins;
        
        System.out.println("Vehicle Details\n"+plate+bar+"Arrival\t"+start_time+"Departure\t"+end_time+bar+"Total Cost: N$ "+getCharge(etime_in_mins-stime_in_mins));
    }
    
    public static String getCharge(int time) {
        if (time<30) {
            return "N$ 0";
        } 
        if (time<8*60) {
            double halfhours = time/30;
            String out = "N$ "+Double.toString(halfhours*2.50);
            if (out.endsWith(".5")){
                out = out+"0";
            }
            return out;
        }
        return "N$ 80";
    }
    
}